package com.codegenerator.config;

import lombok.Data;

import java.util.List;

/**
 * 代码生成器配置类，对应JSON配置文件
 */
@Data
public class GeneratorConfig {
    /**
     * 数据库连接配置
     */
    private DatabaseConfig database;
    
    /**
     * 生成代码的表配置
     */
    private List<TableConfig> tables;
    
    /**
     * 包路径配置
     */
    private PackageConfig packageConfig;
    
    /**
     * 生成文件路径配置
     */
    private PathConfig pathConfig;
    
    /**
     * 作者信息
     */
    private String author;
    
    /**
     * 是否覆盖已有文件
     */
    private boolean overwrite;
    
    /**
     * 数据库连接配置内部类
     */
    @Data
    public static class DatabaseConfig {
        private String url;
        private String username;
        private String password;
        private String driverClassName;
    }
    
    /**
     * 表配置内部类
     */
    @Data
    public static class TableConfig {
        private String tableName;
        private String domainObjectName;
        private String comments;
        private List<ColumnConfig> columns;

        private String primaryKeyJavaType;
    }
    
    /**
     * 列配置内部类
     */
    @Data
    public static class ColumnConfig {
        private String columnName;
        private String dataType;
        private String javaType;
        private String columnComment;
        private boolean primaryKey;
        private boolean autoIncrement;
    }
    
    /**
     * 包路径配置内部类
     */
    @Data
    public static class PackageConfig {
        private String parent;
        private String entity;
        private String mapper;
        private String manager;
        private String service;
        private String serviceImpl;
        private String model;
        private String mapstruct;
    }
    
    /**
     * 路径配置内部类
     */
    @Data
    public static class PathConfig {
        private String baseDir;
        private String javaDir;
        private String resourcesDir;
    }
}
